﻿#include "dtusearchdialog.h"

DTUSearchDialog::DTUSearchDialog()
{
    setup_ui();
    connect(searchButton,&QAbstractButton::clicked, this, &QDialog::accept);
}

DTUSearchDialog::~DTUSearchDialog()
{

}

void DTUSearchDialog::setup_ui()
{
    QGridLayout* layout = new QGridLayout();

    searchButton = new QPushButton(QStringLiteral("查询"));
    id_box = new QSpinBox();
    id_box->setValue(1);
    time_start_ed = new QDateTimeEdit();
    time_start_ed->setDisplayFormat("yyyy/MM/dd HH:mm:ss");
    time_start_ed->setDateTime(QDateTime(QDate(2020,11,22),QTime(15,40)));
    time_start_ed->setCalendarPopup(true);
    time_end_ed = new QDateTimeEdit();
    time_end_ed->setDisplayFormat("yyyy/MM/dd HH:mm:ss");
    time_end_ed->setDateTime(QDateTime(QDate(2020,11,22),QTime(15,50)));
    time_end_ed->setCalendarPopup(true);

    QLabel* id_l = new QLabel(QStringLiteral("DTU序号"));
    QLabel* start_l = new QLabel(QStringLiteral("起止时间"));
    QLabel* to_l = new QLabel(QStringLiteral("~"));
    layout->addWidget(id_l,0,0,1,1);
    layout->addWidget(id_box,0,1,1,1);
    layout->addWidget(start_l,0,2,1,1);
    layout->addWidget(time_start_ed,0,3,1,1);
    layout->addWidget(to_l,0,4,1,1);
    layout->addWidget(time_end_ed,0,5,1,1);
    layout->addWidget(searchButton,0,6,1,1);

    setLayout(layout);
    setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint | Qt::Drawer);
    setWindowTitle(QStringLiteral("查询DTU数据"));
}

